aboutsummaryrefslogtreecommitdiffstats
path: root/apps/mobile/app/dashboard/lists/[slug].tsx
blob: 8596b49fbffb0e5b5ac3562951b584726e6943a7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import { SafeAreaView, View } from "react-native";
import { Stack, useLocalSearchParams } from "expo-router";
import BookmarkList from "@/components/bookmarks/BookmarkList";
import FullPageSpinner from "@/components/ui/FullPageSpinner";
import PageTitle from "@/components/ui/PageTitle";
import { api } from "@/lib/trpc";

export default function ListView() {
  const { slug } = useLocalSearchParams();
  if (typeof slug !== "string") {
    throw new Error("Unexpected param type");
  }
  const { data: list } = api.lists.get.useQuery({ listId: slug });

  return (
    <SafeAreaView>
      <Stack.Screen
        options={{
          headerTitle: "",
          headerBackTitle: "Back",
          headerTransparent: true,
        }}
      />
      {list ? (
        <View>
          <BookmarkList
            query={{
              archived: false,
              listId: list.id,
            }}
            header={<PageTitle title={`${list.icon} ${list.name}`} />}
          />
        </View>
      ) : (
        <FullPageSpinner />
      )}
    </SafeAreaView>
  );
}